<?php
require_once '/home/ubuntu/webserver/workerman-tcp_server/vendor/workerman/mysql-master/src/Connection.php';

/*
//
if (!isset($_POST['time'])) {
$time = $_POST['time'];
} else {
echo "参数错误";
return;
}
 */

$db = new \Workerman\MySQL\Connection('127.0.0.1', 'port', 'root', 'li999888', 'module_db');

$result = $db->select('dev_id')->from('device_list')->query();
$ret = array();
$r = array();
foreach ($result as $key => $value) {
    $r['id'] = $key;
    $r['name'] = $value['dev_id'];
    $r['isParent'] = 'false';
    $ret[$key] = $r;
}
echo json_encode($ret);
